#include<stdio.h>
struct Student{
    char name[20];
    int year;
    int score;
}student[6];

int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%s %d %d",student[i].name,&student[i].year,&student[i].score);
    }
    for(int i=0;i<n;i++){
        if(student[i].score/5*6>=600)student[i].score=600;
        else student[i].score=student[i].score/5*6;
    }
    for(int i=0;i<n;i++){
        printf("%s %d %d\n",student[i].name,student[i].year+1,student[i].score);
    }
}